package spacecraft;

import markgame2d.engine.DefaultCollideable;
import markgame2d.engine.MarkImageLoader;
import markgame2d.engine.MarkSprite;
import markgame2d.engine.interfaces.Collideable;
import markgame2d.engine.interfaces.Updateable;
import markgame2d.engine.mover.MarkConstantMover;
import markgame2d.engine.mover.MarkMover;

public class Missile extends MarkSprite implements Updateable, Collideable{

	private static MarkImageLoader loader = new MarkImageLoader();

	SpaceCraft game;
	
	MarkMover mover;

	public Missile(float x, float y) {
		super(x, y, loader.loadImage(GameScreen.MISSILE_FILE));
		game = SpaceCraft.getInstance();
		makeTransparendByCornerColor();
		mover = new MarkConstantMover(this, GameScreen.MISSILE_VEL, 0);
	}

	public void update(float time) {
		mover.move(time);
	}

	public void onColide(Collideable other) {
		if(other.isAlive()){
			if(other instanceof DefaultCollideable){
				setAlive(false);
			}
		}
	}

}
